package com.zhan.utils;

public class UserAgentUtils {

    public static boolean isPhone(String userAgent) {
        String[] deviceArray = new String[]{"android", "iphone", "ios", "windows phone"};
        userAgent = userAgent.toLowerCase();
        for (int i = 0; i < deviceArray.length; i++) {
            if (userAgent.indexOf(deviceArray[i]) > 0) {
                return true;
            }
        }
        return false;
    }

    public static int phoneType(String userAgent) {
        String[] deviceArray = new String[]{"android", "iphone", "ios", "windows phone"};
        userAgent = userAgent.toLowerCase();
        if (userAgent.indexOf("android") > 0) {
            return 0;
        }
        if (userAgent.indexOf("iphone") > 0 || userAgent.indexOf("ios") > 0) {
            return 1;
        }
        return 99;
    }

}
